Skip to content

Email yourself when your Bots finish, fail or wait for approval - #493

Closed
Birfy wants to merge 6 commits into
ThinkFlowLab:mainfrom
Birfy:feat/355-email-to-self
Closed

Birfy wants to merge 6 commits into
ThinkFlowLab:mainfrom
Birfy:feat/355-email-to-self

Conversation

@Birfy

@Birfy Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Part of #355 (first slice per the Owner decision: email to yourself; Slack, retries/delivery log and the 24/7 runtime stay open there).

What. With your opt-in (Settings → General → Email me, off by default), the events behind the system notifications of #353 — one of your own Bots finished or failed a turn, or an approval started waiting — also go to your own address: one short line each (who, what, group name) plus a link back into FlyBot. No chat text, tool name or arguments; "Approve or reject only in FlyBot. Replies to this email are not read." One email per one-minute batch, at most one every five minutes; approvals answered before the send are left out; switching off drops what waits.

How. New core/src/host/email.js: settings from the environment only (FLYBOT_SMTP_URL = your own SMTP account, smtps:// or smtp:// + STARTTLS; FLYBOT_EMAIL_TO = the only recipient; FLYBOT_URL = the link). Minimal SMTP client on node:net/node:tls with certificate checks; a password is never sent without TLS; a failure is logged with its code only, never the server's text or the password. Hooks: one line each in turns.js (noteEnded) and approvals.js. View carries email: { to } | null (hidden with more than one member, authz.js); set-prefs takes email and refuses true when nothing is set up. Only while the deployment has one member. compose.yaml passes the three variables through; guide in docs/docker.md (+ zh). No new dependency, no paid service, no relay we run.

Test. core/test/email.test.js (config parsing and rejection of malformed values/header injection, message encoding, SMTP exchange against a local fake server, password refused without TLS, reply-code-only errors, batching/gap, off by default / multi-member / unset / switched off, answered approvals dropped, approvals hook), turn hook in approval-notices.test.js, set-prefs in install.test.js, compose passthrough in docker-profile.test.mjs. ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify passes. Ad hoc (not committed): STARTTLS + AUTH PLAIN and implicit TLS against a local TLS server with a self-signed cert trusted via NODE_EXTRA_CA_CERTS, a wrong password gives SMTP_535, an untrusted cert is refused.

Risk tier: T3 (estimate; the controller sets the label) — sends email off the box, touches authz.js / channel.js.

@Birfy Birfy self-assigned this Oct 20, 2026
@Birfy Birfy added agent-pr Pull request opened by an agent enhancement New feature or request area:automation Scheduled tasks and automation labels Oct 20, 2026
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review: PASS
Tip SHA: 3d0c4a1
Ran:

  • ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify: pass (core lint + arch-docs OK, plugin lint, client bundle check, ds-bot patches check, core 1086/1086, social 296/296, tree 80/80, timeline 83/83, .github scripts 93/93, interop 37/37, live-e2e 16/16)
  • node .github/scripts/changelog.mjs check: 18 fragments well formed
  • CI at this SHA: all green (tests-ok, test, plugins social/tree/timeline, package, Docker build and start check, risk tier T3 report)
  • Ad hoc, not committed: STARTTLS + AUTH PLAIN and implicit TLS (smtps) against a local TLS SMTP stub with a self-signed cert trusted via NODE_EXTRA_CA_CERTS; wrong password → SMTP_535; untrusted cert → refused (DEPTH_ZERO_SELF_SIGNED_CERT)
  • Design rules checked: an email carries no approval path (no link that approves, "Replies to this email are not read"; approve only via in-app buttons); recipient is only the owner's own FLYBOT_EMAIL_TO; switch off by default; SMTP password never saved, shown, logged or sent without TLS; no connector token path touched; English UI with zh strings; no new menu or section; scope limited to the first slice (Slack, retries/delivery log, 24/7 runtime stay in Proactive reminders 3/3: 24/7 runtime and Slack/email delivery #355)
    Not run:
  • A real mail provider (Gmail/Outlook SMTP) end to end, and the Docker image with SMTP variables set
  • Live Mac instances and the DSH Web UI by hand (the Email me switch was checked through tests and the bundle build only)

@Birfy Birfy added the awaiting-approval PR is green and waits for the maintainer's approval (T2/T3) or a review PASS at its tip label Oct 20, 2026
@github-actions github-actions Bot added the risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff label Oct 20, 2026
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review: PASS
Tip SHA: 8eff14c
Ran:

Keep ThinkFlowLab#355 email noticeOffApp on ended turns; use main's trimEnded for
ThinkFlowLab#471 failed-turn retention. Restore approvals.js in patch topics and
regenerate client bundle and ds-bot patches.
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review: PASS
Tip SHA: d0f0b27
Ran:

  • ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify (pass)
  • reviewed diff at tip vs owner design rules
    Not run:
  • live Mac instances / production Bot Social

@Birfy
Birfy added this pull request to the merge queue Oct 20, 2026
@Birfy
Birfy removed this pull request from the merge queue due to a manual request Oct 20, 2026
@Birfy
Birfy added this pull request to the merge queue Oct 20, 2026
@Birfy
Birfy removed this pull request from the merge queue due to a manual request Oct 20, 2026
# Conflicts:
#	core/client.js
#	core/src/client/settings.js
#	core/src/host/channel.js
#	core/test/install.test.js
#	docs/subsystems/core-client.md
#	patches/ds-bot/0001-core-fixes.patch
#	patches/ds-bot/0005-social-seams.patch
#	patches/ds-bot/0008-client-bundle.patch
#	patches/ds-bot/0014-flybot-branding.patch
@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review: PASS
Tip SHA: d067b0e
Ran:

@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Self-review (review-pr, Birfy reviewer agent, 2026-10-20 20:41 Asia/Shanghai): PASS (merge-main conflict fix; no feature change)

Tip SHA: 7ef9234
Ran:

  • git merge origin/main twice into the branch, no rebase or force-push: first b6e89d2 (after Timeline: an on-demand export endpoint #524, Polish invites and friend chats: friend Bot placeholder, one invite control, Add friend auto-close, Sharing hint #504, Show a tree coordinator its children's runtime load #508, Add an opt-in state journal and a dev replay script #527, Show each scheduled task's last run, and Retry a failed one #494), then cf61952 (after Name a friend's Bot one way and approval cards by the receiving person #502, which landed while this was being checked) → pass. The first merge's only conflict was the generated patches/ds-bot/0001-core-fixes.patch. The second merge was clean. No hand-merged real sources
  • generated files regenerated, not hand-merged, after each merge: git checkout origin/main -- patches/ds-bot, then this PR's topics.json entry restored (src/host/approvals.js in 0001-core-fixes; main's file would otherwise drop it), (cd core && npm run build), node scripts/ds-bot-patches.mjs generate, check → pass (10 patches apply cleanly; core/ = ds-bot/ + patches)
  • ARCH_DOCS_BASE=origin/main TZ=UTC npm run verify (core lint + arch-docs OK with 29 changed files, plugin lint, build-client --check, ds-bot-patches check, all suites) → pass, 0 failures (core 1123, social 313, tree 83, timeline 93, .github scripts 93, interop 37, live-e2e 16). A parallel run had one failure in connectors.test.js 'an address saved by an older version…', the known load flake. It passed 3/3 alone, and the full verify rerun passed
  • smoke (PR touches core/index.js and core/src/host/): CONTEXT_WINDOW=100000 CHECK_RATIO=0.45 dev/bench.sh smoke493 3296 8996 reset && node dev/smoke.mjs smoke493 3296 against DSH 0.2.0-rc.2, on the cf61952 merge → pass, all 42 steps; bench stopped afterwards
  • CI on this tip → all checks pass (tests-ok, ubuntu-latest · Node 24 · DSH 0.2.0-rc.2, plugins social/timeline/tree, package, build and start check, risk tier, reviewed tip); MERGEABLE / CLEAN
  • re-read the diff against main at this tip: 29 files, one changelog.d fragment (355-email-to-self.added.md), no CHANGELOG.md or ds-bot/ edits, no node_modules links committed
    Not run:
  • live Mac instances / DSH Desktop / real-model live-e2e (no key; mock model only)
  • sending a real email (SMTP mocked in tests)
  • production Bot Social (not in scope)
    Verdict: PASS

Findings: none to act on. This review does not authorize a merge: risk:T3 still needs the maintainer's approval (the owner queues it).

@Birfy

Birfy commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

Owner decision (2026-10-20 21:12 Asia/Shanghai): closing — won't do.

@Birfy Birfy closed this Oct 20, 2026
@Birfy Birfy removed awaiting-approval PR is green and waits for the maintainer's approval (T2/T3) or a review PASS at its tip agent-pr Pull request opened by an agent labels Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:automation Scheduled tasks and automation enhancement New feature or request risk:T3 Risk tier T3 (needs a human approval), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant